#pragma once

#include <stdio.h>
#include <vector>
#include <string>
#include <render/Others/PerseusLibDefines.h>
#include <render/Model/ModelVertex.h>
#include <render/Model/ModelFace.h>
#include <render/Model/ModelH.h>

namespace pwp {

enum ObjFormat {
  FMT_OBJ,
  FMT_PLY
};

class Model {
private:
  int createFromObjData(const char* data_ptr, int data_size, float scale);
  int createFromPlyData(const char* data_ptr, int data_size, float scale);

public:
  std::vector<ModelFace> faces;
  std::vector<ModelVertex> vertices;

  VECTOR3DA lbn;
  VECTOR3DA rtf;

  std::vector<float> verticesVector;

  VFLOAT minZ;

  int faceCount;

  Model();
  Model(const char* data_ptr, int data_size, ObjFormat fmt, float scale = 1.0f);
  Model(std::string fileName, float scale = 1.0f);

  void ToModelH(ModelH* newModel);
  void ToModelHInit(ModelH* newModel);
};

}
